package com.iqiyi.dbagent.base.sources.impl;

import org.apache.commons.dbcp.BasicDataSourceFactory;

import com.iqiyi.dbagent.base.config.MySqlConfig;
import com.iqiyi.dbagent.base.sources.i.AbstractDataSource;

public class DbcpSourceMysql extends AbstractDataSource {

	private volatile static DbcpSourceMysql instance;	
	
	
	private DbcpSourceMysql() throws Exception {
		dataSource = BasicDataSourceFactory.createDataSource(MySqlConfig.getInstance().getP());		
	}

	public static DbcpSourceMysql getInstance() throws Exception {
		if (instance == null) {
			synchronized (DbcpSourceMysql.class) {
				if (instance == null) {
					instance = new DbcpSourceMysql();
				}
			}
		}
		return instance;
	}	
	
}
